package com.winit.agent.model;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "matrix_agent")
public class Agent implements Serializable{
    private String agentId;
    private String agentIp;
    private String agentPort;

    @Id
    @Column(name = "agent_id")
    public String getAgentId() {
        return agentId;
    }

    public void setAgentId(String agentId) {
        this.agentId = agentId;
    }

    @Basic
    @Column(name = "agent_ip")
    public String getAgentIp() {
        return agentIp;
    }

    public void setAgentIp(String agentIp) {
        this.agentIp = agentIp;
    }

    @Basic
    @Column(name = "agent_port")
    public String getAgentPort() {
        return agentPort;
    }

    public void setAgentPort(String agentPort) {
        this.agentPort = agentPort;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Agent that = (Agent) o;

        if (agentId != null ? !agentId.equals(that.agentId) : that.agentId != null) return false;
        if (agentIp != null ? !agentIp.equals(that.agentIp) : that.agentIp != null) return false;
        if (agentPort != null ? !agentPort.equals(that.agentPort) : that.agentPort != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = agentId != null ? agentId.hashCode() : 0;
        result = 31 * result + (agentIp != null ? agentIp.hashCode() : 0);
        result = 31 * result + (agentPort != null ? agentPort.hashCode() : 0);
        return result;
    }
}
